Skip to content

fix(console-ui): make sidebar navigation native#458

Merged
Gajesh2007 merged 1 commit into
masterfrom
fix/console-sidebar-native-nav-20260623
Jun 24, 2026
Merged

fix(console-ui): make sidebar navigation native#458
Gajesh2007 merged 1 commit into
masterfrom
fix/console-sidebar-native-nav-20260623

Conversation

@Gajesh2007

@Gajesh2007 Gajesh2007 commented Jun 24, 2026

Copy link
Copy Markdown
Member

Summary

  • Replaces next/link for sidebar shell navigation with native anchors so clicks are no longer captured by the broken client-router path.
  • Keeps active-route styling and mobile sidebar close behavior intact.

Before

flowchart LR
  subgraph Behavior_Before[Behavior]
    U1[User clicks Stats in sidebar] --> L1[Next Link delegated click handler]
    L1 --> P1[preventDefault on anchor]
    P1 --> R1[Client router does not push/fetch]
    R1 --> S1[URL stays on current route]
  end
  subgraph Code_Before[Code]
    C1[Sidebar nav item] --> C2[next/link Link]
    C2 --> C3[Next app-router client navigation]
  end
Loading

After

flowchart LR
  subgraph Behavior_After[Behavior]
    U2[User clicks Stats in sidebar] --> A1[Native anchor href=/stats]
    A1 --> B1[Browser performs route load]
    B1 --> S2[/stats renders and Stats is active]
  end
  subgraph Code_After[Code]
    C4[Sidebar nav item] --> C5[plain a href]
    C5 --> C6[closeSidebarOnMobile only]
    C6 --> C7[Browser-native navigation]
  end
Loading

Test plan

  • npm run build passed from the fix worktree. Because disk was full, validation used the existing dependency tree with a temporary Turbopack root override that was removed before commit.
  • npx eslint src/ passed with 0 errors; existing repo warnings remain.
  • Browser proof on http://localhost:3017: clicking the actual Stats sidebar link changed location.pathname to /stats and made Stats active.

Made with Cursor


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Avoid the broken Next Link client-router path for shell navigation so sidebar clicks always fall back to browser-native route loads.
@vercel

vercel Bot commented Jun 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
d-inference Ready Ready Preview Jun 24, 2026 12:21am
d-inference-console-ui-dev Ready Ready Preview Jun 24, 2026 12:21am
d-inference-landing Ready Ready Preview Jun 24, 2026 12:21am

Request Review

@github-actions

Copy link
Copy Markdown

No security-relevant changes detected — this PR modifies only console-ui/src/components/Sidebar.tsx, which is a UI layout component not covered by any threat model affected_files pattern.

No trust boundaries are touched by this diff. A sidebar component that handles navigation state, display logic, or styling does not introduce new attack surface unless it meets one of the following conditions (none of which are visible without seeing the actual diff):

  • It renders user-controlled content without sanitization (→ T-019 / XSS blast radius)
  • It reads from or writes to localStorage in a way that interacts with auth state or chat history (→ T-018, T-001)
  • It constructs URLs or makes fetch calls using client-supplied input (→ T-017 / SSRF)
  • It conditionally hides/shows privileged UI based on client-side auth state alone (→ T-020)

If the diff does any of the above, re-run this review with the full file content. Otherwise no threat model update is needed.


🔐 Threat model: docs/threat-model.yaml · Updates on each push to this PR

@ethenotethan ethenotethan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated Code Review — Layr-Labs/d-inference#

Verdict: REQUEST_CHANGES

Security — ✅ No issues found

Performance — 1 finding(s) (1 blocking)

  • 🟡 [MEDIUM] console-ui/src/components/Sidebar.tsx:44-46 — Window width check repeated on every mobile click instead of using media query or cached value
    • Suggestion: Use CSS media queries for responsive behavior or cache window.innerWidth check with resize listener to avoid repeated DOM queries

Type_diligence — ✅ No issues found

Additive_complexity — 1 finding(s)

  • 🔵 [INFO] console-ui/src/components/Sidebar.tsx:22 — useRouter import is no longer used after removing Next.js Link components
    • Suggestion: Remove unused useRouter import from next/navigation

2 finding(s) total, 1 blocking. Verdict: REQUEST_CHANGES.

🤖 Automated review by Centaur · DAR-186

Comment on lines +44 to +46
const closeSidebarOnMobile = () => {
if (window.innerWidth < 640) setSidebarOpen(false);
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 [MEDIUM] ⚡ Window width check repeated on every mobile click instead of using media query or cached value

💡 Suggestion: Use CSS media queries for responsive behavior or cache window.innerWidth check with resize listener to avoid repeated DOM queries

📊 Score: 2×4 = 8 · Category: Repeated work

@@ -19,7 +20,6 @@ import {
Sun,
Moon,
} from "lucide-react";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 [INFO] 🧩 useRouter import is no longer used after removing Next.js Link components

💡 Suggestion: Remove unused useRouter import from next/navigation

📊 Score: 2×3 = 6 · Category: dead code

@Gajesh2007 Gajesh2007 merged commit 80ce257 into master Jun 24, 2026
22 of 23 checks passed
anupsv added a commit that referenced this pull request Jun 24, 2026
…-install tabs (#462)

The provider dashboard tabs (Dashboard/Setup/Earnings) and the onboarding
"Set up a provider" / "Open calculator" buttons used next/link, whose client
router is currently broken app-wide (the #457/#458 regression): the links
render but router.push silently no-ops, so clicking them never switched pages.
#458 converted only the sidebar to native <a> and explicitly left the broken
Link path in place; these dashboard surfaces were never converted.

- Switch the providers tabs, onboarding CTAs, and the dashboard fix-affordance
  internal links to native <a> navigation (browser-native route loads), the
  same workaround #458 used for the sidebar.
- Gate the Setup/Earnings tabs behind a one-shot "has linked providers" check
  so they appear only after a machine is linked; pre-install shows just the
  Dashboard, whose onboarding state owns the setup flow. The check starts false
  and reads state only inside an effect, so the first render is deterministic
  (no hydration mismatch).
anupsv added a commit that referenced this pull request Jun 24, 2026
…tion (root cause) (#463)

VerificationModeProvider — added in #450 and wrapping the entire app — read
localStorage in its useState initializer, so the first client render diverged
from the server HTML whenever the user had toggled "technical" mode. On a React
hydration mismatch the server DOM is discarded and the tree is regenerated on
the client, which breaks App Router client navigation app-wide: next/link renders
but router.push silently no-ops (links don't switch pages).

This is the regression #457 chased — it made the store and InviteCodeBanner
hydration-deterministic but missed this provider — and #458 then band-aided by
switching the sidebar to native <a>.

Fix: start "normal" on the server and the first client render, then load the
persisted preference in an effect (the same hydration-determinism pattern as
#457). Adds a regression test pinning the deterministic first render.

This is the root-cause fix for the broken Link client router; the native-<a>
workarounds (#458 sidebar, #462 provider tabs) can be reverted in a follow-up
once verified on a preview deploy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants